#include "Thread.h"

//#include <SDL.h>
#include <SDL_thread.h>
#include <assert.h>

//making function static means that only this cpp program can call without making it specific to the cpp file.
static int myThreadFunc(void* data)
{
	//Taks a pointer to data and defines it as a pointer to a thread
	Thread* myThread = reinterpret_cast<Thread*>(data);
	assert(dynamic_cast<Thread*>(myThread));
	myThread->Work();
	return 0;
}


Thread::Thread() : m_threadFinished(false), m_pThread(0) 
{

}

void Thread::Start()
{

	m_pThread = SDL_CreateThread(myThreadFunc, this);
	
}

void Thread::EndThread()
{

	m_threadFinished = true; 
}

bool Thread::IsThreadFinished()
{
	return m_threadFinished;
}


//virtual void Thread::Work()
//{}


